﻿namespace FiftyOne.Foundation.Mobile.Configuration
{
    using System;
    using System.Configuration;

    public class RedirectSection : ConfigurationSection
    {
        [ConfigurationProperty("devicesFile", IsRequired=false), StringValidator(InvalidCharacters="!@#$%^&*()[]{};'\"|", MaxLength=0xff)]
        public string DevicesFile
        {
            get
            {
                return (string) base["devicesFile"];
            }
        }

        internal bool Enabled
        {
            get
            {
                return base.ElementInformation.IsPresent;
            }
        }

        [ConfigurationProperty("errorImageUrl", DefaultValue=""), StringValidator(MaxLength=0xff)]
        public string ErrorImageUrl
        {
            get
            {
                return (string) base["errorImageUrl"];
            }
        }

        [ConfigurationProperty("firstRequestOnly", IsRequired=false, DefaultValue="true")]
        public bool FirstRequestOnly
        {
            get
            {
                return (bool) base["firstRequestOnly"];
            }
        }

        [StringValidator(MaxLength=0xff), ConfigurationProperty("mobileHomePageUrl", IsRequired=true, DefaultValue="")]
        public string MobileHomePageUrl
        {
            get
            {
                return (string) base["mobileHomePageUrl"];
            }
        }

        [StringValidator(MaxLength=0x800), ConfigurationProperty("mobilePagesRegex", IsRequired=false, DefaultValue="")]
        public string MobilePagesRegex
        {
            get
            {
                return (string) base["mobilePagesRegex"];
            }
        }

        [ConfigurationProperty("timeout", IsRequired=false, DefaultValue="20")]
        public int Timeout
        {
            get
            {
                return (int) base["timeout"];
            }
        }
    }
}

